﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HousingDistribution
{
    class HousingDisWeightProc
    {
        public bool WeightEqual(PersonTypeEnum type, PersonSortInfo per1, PersonSortInfo per2)
        {
            if (type == PersonTypeEnum.ArmMan)
            {
                return CompareArmmanWeight(per1, per2);
            }
            else if (type == PersonTypeEnum.Staff)
            {
                return CompareStaffWeight(per1, per2);
            }
            else if (type == PersonTypeEnum.NCO)
            {
                return CompareNCOWeight(per1, per2);
            }
            else if (type == PersonTypeEnum.Worker)
            {
                return CompareWorkerWeight(per1, per2);
            }
            else
                return false;
        }
        
        bool CompareArmmanWeight(PersonSortInfo per1, PersonSortInfo per2)
        {
            if (
                per1.sortCurGradeBeforeTime.CompareTo(per2.sortCurGradeBeforeTime) == 0
                && per1.sortWorkTime.CompareTo(per2.sortWorkTime) == 0
                && per1.sortSignupTime.CompareTo(per2.sortSignupTime) == 0)
                return true;
            else
                return false;
        }

        
        bool CompareStaffWeight(PersonSortInfo per1, PersonSortInfo per2)
        {
            if (
                per1.sortCurGradeBeforeTime.CompareTo(per2.sortCurGradeBeforeTime) == 0
                && per1.sortWorkTime.CompareTo(per2.sortWorkTime) == 0
                && per1.sortSignupTime.CompareTo(per2.sortSignupTime) == 0)
                return true;
            else
                return false;
        }

        bool CompareNCOWeight(PersonSortInfo per1, PersonSortInfo per2)
        {
            if (
                per1.sortCurGradeBeforeTime.CompareTo(per2.sortCurGradeBeforeTime) == 0
                && per1.sortWorkTime.CompareTo(per2.sortWorkTime) == 0
                && per1.sortSignupTime.CompareTo(per2.sortSignupTime) == 0)
                return true;
            else
                return false;
        }
        
        bool CompareWorkerWeight(PersonSortInfo per1, PersonSortInfo per2)
        {
            if (
                per1.sortCurGradeBeforeTime.CompareTo(per2.sortCurGradeBeforeTime) == 0
                && per1.sortWorkTime.CompareTo(per2.sortWorkTime) == 0
                && per1.sortSignupTime.CompareTo(per2.sortSignupTime) == 0)
                return true;
            else
                return false;
        }

    }
}
